package com.test.mywebtest.controller;


import com.test.mywebtest.util.DCSUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/yl")
public class YLController {


    String yzOnlinePreview2 = "http://192.168.81.173:18080/fcscloud/composite/upload";

    @RequestMapping("/onlinePreviewMail")
    public void onlinePreviewMail(HttpServletResponse response, MultipartFile file,
                                  @RequestParam(name = "fileName") String fileName,
                                  @RequestParam(name = "watermarkText", required = false) String watermarkText) {

        if (file.getSize() > 0) {
            String originalFilename = file.getOriginalFilename();
            System.out.println(originalFilename);

            Map<String, String> map = new HashMap<String, String>();
            map.put("convertType", "3");

            String s = DCSUtils.doPostFile(yzOnlinePreview2, file, originalFilename, map);

            System.out.println(s);


        }

    }


}
